package com.water.wl.newwater.api;

import android.util.Log;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

/**
 * Created by wds1993225 on 2016/3/10.
 */
public class ApiClient {

    private static AsyncHttpClient client = new AsyncHttpClient();

    private static String API_URL = "http://www.oschina.net/%s";

    private String tweetUrl = "action/api/tweet_list";




   public static void get(String partUrl, RequestParams params,
                          AsyncHttpResponseHandler handler) {
       client.get(getAbsoluteApiUrl(partUrl), params, handler);
   }

    public static String getAbsoluteApiUrl(String partUrl) {
        String url = partUrl;
        if (!partUrl.startsWith("http:") && !partUrl.startsWith("https:")) {
            url = String.format(API_URL, partUrl);
        }
        Log.d("BASE_CLIENT", "request:" + url);
        return url;
    }



}
